package cn.edu.scau.cmi.youbaiquan.controller;

import java.awt.Event;
import java.awt.event.ActionEvent;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;

public class ComprehensiveController {

    @FXML
    private ResourceBundle resources;

    @FXML
    private URL location;

    @FXML
    private Button btn_singleton;

    @FXML
    private Button btn_factory;

    @FXML
    private Button btn_abstract_factory;

    @FXML
    private Button btn_simple_factory;

    @FXML
    private Button btn_adapter;

    @FXML
    private Button btn_composite;

    @FXML
    void initialize() {
        assert btn_singleton != null : "fx:id=\"btn_singleton\" was not injected: check your FXML file 'ComprehensiveUI.fxml'.";
        assert btn_factory != null : "fx:id=\"btn_factory\" was not injected: check your FXML file 'ComprehensiveUI.fxml'.";
        assert btn_abstract_factory != null : "fx:id=\"btn_abstract_factory\" was not injected: check your FXML file 'ComprehensiveUI.fxml'.";
        assert btn_simple_factory != null : "fx:id=\"btn_simple_factory\" was not injected: check your FXML file 'ComprehensiveUI.fxml'.";
        assert btn_adapter != null : "fx:id=\"btn_adapter\" was not injected: check your FXML file 'ComprehensiveUI.fxml'.";
        assert btn_composite != null : "fx:id=\"btn_composite\" was not injected: check your FXML file 'ComprehensiveUI.fxml'.";

    }
    
    
    @FXML
    void abstractFactory( ) {
    	Stage stage = new Stage();
		try {
			Parent root = FXMLLoader.load(getClass().getResource("/layout/AbstractFactoryUI.fxml"));
			stage.setTitle("抽象工厂方法模式");
			stage.setScene(new Scene(root));
			stage.show();
		}catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
    }
    
    @FXML
    void adapter( ) {
    	Stage stage = new Stage();
    	try {
			Parent root = FXMLLoader.load(getClass().getResource("/layout/AdapterUI.fxml"));
			stage.setTitle("适配器模式");
			stage.setScene(new Scene(root));
			stage.show();
		}catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
    }
    
    @FXML
    void composite( ) {
    	Stage stage = new Stage();
		try {
			Parent root = FXMLLoader.load(getClass().getResource("/layout/CompositeUI.fxml"));
			stage.setTitle("组合模式模式");
			stage.setScene(new Scene(root));
			stage.show();
		}catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
    }
    
    @FXML
    void factoryPattern() {
    	Stage stage = new Stage();
		try {
			Parent root = FXMLLoader.load(getClass().getResource("/layout/FactoryPatternUI.fxml"));
			stage.setTitle("工厂方法模式");
			stage.setScene(new Scene(root));
			stage.show();
		}catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
    }
    
    @FXML
    void simpleFactory( ) {
    	Stage stage = new Stage();
		try {
			Parent root = FXMLLoader.load(getClass().getResource("/layout/SimpleFactoryUI.fxml"));
			stage.setTitle("简单工厂模式");
			stage.setScene(new Scene(root));
			stage.setResizable(false);
			stage.show();
		}catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
    }
    
    @FXML
    void singleton( ) {
    	Stage stage = new Stage();
    	try {
			Parent root = FXMLLoader.load(getClass().getResource("/layout/SingletonScene.fxml"));
			stage.setTitle("单例模式");
			stage.setScene(new Scene(root));
			stage.show();
		}catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
    }
    
   
    
    
}
